package com.ydd.mapper;

import com.ydd.entity.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydd.vo.MenuList;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 菜单表 Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */

public interface SysMenuMapper extends BaseMapper<SysMenu> {
    /**
     * 查找角色的一级菜单
     * @param id
     * @return
     */
    @Select("SELECT * FROM sys_menu sm LEFT JOIN sys_role_menu srm on srm.menu_id=sm.id LEFT JOIN sys_role sr on sr.id=srm.role_id WHERE sr.id= #{id} and sm.type=1 and sm.pid=#{pid}")
    List<MenuList> getMenuByRoleId(String id, Integer pid);
}
